<template>
  <el-container>
    <el-aside width="250px">
      <el-header :style="{ height: mainH + 'px', padding: '0' }">
        <!--      <el-header style="height: 200px;">-->
        <hostsGroupTable function_choice="query" @childClick="envClick" />
      </el-header>
      <el-main :style="{ padding: '0' }">
        <K8sclusterEnvTable @childClick="k8sclusterClick" :env_id="env_id" />
      </el-main>
    </el-aside>
    <el-container>
      <el-header style="font-size: 12px; width: 100%; height: auto;">
        <el-button type="primary" size="small" @click="open_conf_dialog_value = true">集群管理</el-button>
        <el-button type="primary" size="small" @click="k8s_pod_image_version_compare_dialog_value = true">版本比较
        </el-button>
        <el-button type="primary" size="small" @click="k8s_namespace_sync_dialog_value = true">空间同步
        </el-button>
      </el-header>
      <el-tabs v-model="activeName_1" @tab-click="tab_table_click">
        <el-tab-pane label="主机角色" name="host">
          <el-tooltip class="box-item" effect="dark" content="监控信息获取间隔" placement="top">
            <el-input style="width: 40px" v-model="get_node_cadvisor_info_monitoring_time" size="small"
              placeholder="搜索" />
          </el-tooltip>
          <el-tooltip class="box-item" effect="dark" content="刷新" placement="top">
            <el-button type="primary" size="small" @click="flush_info" class="el-button_more_mini" icon="Refresh" />
          </el-tooltip>
          <el-button type="primary" size="small" @click="get_k8s_api_sign" class="el-button_more_mini">API标记</el-button>
          <el-button type="primary" size="small" class="el-button_more_mini" @click="verify_node_info">角色校验</el-button>
          <el-button type="warning" size="small" @click="configuration_dialog = true"
            class="el-button_more_mini">角色部署</el-button>
          <el-button type="danger" size="small" class="el-button_more_mini"
            @click="dialog_cluster_role_quit = true">卸载</el-button>

          <el-button type="primary" size="small" @click="k8s_cluster_check_dialog"
            class="el-button_more_mini">归属集群</el-button>
          <el-button type="primary" size="small" @click="k8s_cluster_check_dialog" class="el-button_more_mini"
            disabled>标签管理</el-button>
          <el-button type="primary" size="small" @click="k8s_cluster_check_dialog" class="el-button_more_mini"
            disabled>污点管理</el-button>
          <el-table highlight-current-row size="small" :data="host_table_k8s" tooltip-effect="dark"
            :cell-style="{ padding: 0 }" style="font-size: 10px; width: 100%" @current-change="host_pitch_on"
            @selection-change="selection_host_table">
            <el-table-column type="selection" width="55"> </el-table-column>
            <el-table-column label="IP" prop="host_ip" width="120">
            </el-table-column>
            <el-table-column prop="" label="" show-overflow-tooltip width="30">
              <template v-slot="scope">
                <el-icon size="15" v-if="scope.row.kubernetes_cluster_sign_id" style="color: #67c23a">
                  <el-tooltip class="box-item" effect="dark" content="API标记" placement="top">
                    <Mic />
                  </el-tooltip>
                </el-icon>
              </template>
            </el-table-column>
            <el-table-column prop="k8s_roles_type_text" label="角色" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="kubelet_ready" label="节点状态" show-overflow-tooltip>
              <template v-slot="scope">
                <el-icon size="12" v-if="scope.row.role_status === '0'" style="color: #f56c6c">
                  <el-tooltip class="box-item" effect="dark" content="失败" placement="top">
                    <lightning />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.role_status === '1'" style="color: #67c23a">
                  <el-tooltip class="box-item" effect="dark" content="成功" placement="top">
                    <sunrise />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.role_status === '2'" style="color: #e6a23c">
                  <el-tooltip class="box-item" effect="dark" content="警告" placement="top">
                    <mostly-cloudy />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.role_status === '-1'" style="color: #909399">
                  <el-tooltip class="box-item" effect="dark" content="无" placement="top">
                    <moon-night />
                  </el-tooltip>
                </el-icon>
              </template>
            </el-table-column>
            <el-table-column prop="node_taints_number" label="污点" show-overflow-tooltip>
              <template v-slot="scope">
                <el-tooltip class="box-item" effect="dark" :content=scope.row.node_taints placement="top">
                  {{ scope.row.node_taints_number }}
                </el-tooltip>
              </template>
            </el-table-column>
            <el-table-column prop="memory_use_text" label="内存(G)" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="cpu_use_text" label="CPU(core)" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="pod_number" label="POD数" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="container_fs_io_current" label="I/O" show-overflow-tooltip>
            </el-table-column>
            <el-table-column prop="deploy_event_status" label="信息状态" show-overflow-tooltip>
              <template v-slot="scope">
                <el-icon size="12" v-if="scope.row.deploy_event_status === '0'" style="color: #f56c6c">
                  <el-tooltip class="box-item" effect="dark" content="失败" placement="top">
                    <lightning />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.deploy_event_status === '1'" style="color: #67c23a">
                  <el-tooltip class="box-item" effect="dark" content="成功" placement="top">
                    <sunrise />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.deploy_event_status === '2'" style="color: #e6a23c">
                  <el-tooltip class="box-item" effect="dark" content="警告" placement="top">
                    <mostly-cloudy />
                  </el-tooltip>
                </el-icon>
                <el-icon size="12" v-if="scope.row.deploy_event_status === '-1'" style="color: #909399">
                  <el-tooltip class="box-item" effect="dark" content="无" placement="top">
                    <moon-night />
                  </el-tooltip>
                </el-icon>
              </template>
            </el-table-column>
            <el-table-column prop="deploy_event_info" label="信息" show-overflow-tooltip>
            </el-table-column>
          </el-table>
        </el-tab-pane>

        <KubernetesManageServiceManage ref="GetK8sClusterServiceRef"></KubernetesManageServiceManage>

        <KubernetesManageDeployments ref="KubernetesManageDeploymentsRef"></KubernetesManageDeployments>

        <KubernetesManageStatefulSet ref="KubernetesManageStatefulSetRef"></KubernetesManageStatefulSet>

        <KubernetesManageJob ref="KubernetesManageJobRef"></KubernetesManageJob>

        <KubernetesManagePodManage ref="GetK8sClusterPodRef"></KubernetesManagePodManage>

        <KubernetesManageCRD ref="GetK8sClusterCRDRef"></KubernetesManageCRD>

        <KubernetesManageStorage ref="KubernetesManageStorageRef"></KubernetesManageStorage>

      </el-tabs>
    </el-container>
  </el-container>

  <el-dialog title="部署配置" v-model="configuration_dialog">
    <div style="height: 60vh; overflow: auto">
      <el-tabs v-model="activeName_2">
        <el-tab-pane label="通用配置" name="configuration_general">
          <el-form :model="configuration_form" size="small" :inline="true">
            <el-row>
              <el-form-item label="系统">
                <el-radio v-model="configuration_form.system_name" label="centos">CentOS(RHEL)</el-radio>
                <el-radio v-model="configuration_form.system_name" label="rocky">rocky(RHEL)</el-radio>
              </el-form-item>
            </el-row>
            <el-form-item label="版本">
              <el-radio v-model="configuration_form.system_version" label="7">7</el-radio>
              <el-radio v-model="configuration_form.system_version" label="9">9</el-radio>
            </el-form-item>
            <el-row>
              <el-form-item label="防火墙">
                <el-switch v-model="configuration_form.firewalld" active-color="#13ce66" inactive-color="#ff4949">
                </el-switch>
              </el-form-item>
              <el-form-item label="SELinux" style="margin-left: 5vh">
                <el-switch v-model="configuration_form.selinux" active-color="#13ce66" inactive-color="#ff4949">
                </el-switch>
              </el-form-item>
              <el-form-item label="运行时、kubelet(启动、开机启动)" style="margin-left: 5vh">
                <el-switch v-model="configuration_form.powerboot" active-color="#13ce66" inactive-color="#ff4949"
                  disabled>
                </el-switch>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="绑定集群">
                <el-select v-model="configuration_form.kubernetes_cluster_id" placeholder="Select">
                  <el-option v-for="item in k8s_cluster_list" :key="item.kubernetes_cluster_id"
                    :label="item.kubernetes_cluster_name" :value="item.kubernetes_cluster_id">
                  </el-option>
                </el-select>
              </el-form-item>
            </el-row>
            <el-row>
              <el-form-item label="绑定角色">
                <SysCodeInput size="small" sys_code_type="k8s_roles_type" @childClick="k8s_role_check_CodoClick"
                  :sys_code_value="configuration_form.kubernetes_role" />
              </el-form-item>
            </el-row>
          </el-form>
        </el-tab-pane>
      </el-tabs>
    </div>
    <template #footer>
      <span class="dialog-footer">
        <el-button @click="configuration_dialog = false" size="small">取 消</el-button>
        <el-button type="primary" @click="k8s_role_initialize" size="small">确 定</el-button>
      </span>
    </template>
  </el-dialog>

  <el-dialog v-model="dialog_cluster_select_visible" title="选择绑定的集群" width="20%">
    <el-select filterable v-model="cluster_select_visible" placeholder="请选择">
      <el-option v-for="item in cluster_data" :key="item.kubernetes_cluster_id" :label="item.kubernetes_cluster_name"
        :value="item.kubernetes_cluster_id">
      </el-option>
    </el-select>
    <template #footer>
      <span class="dialog-footer">
        <el-button size="small" @click="dialog_cluster_select_visible = false">取消</el-button>
        <el-button size="small" type="primary" @click="save_k8s_cluster_host">确认</el-button>
      </span>
    </template>
  </el-dialog>

  <el-dialog v-model="dialog_cluster_role_quit" title="确认卸载选择主机角色吗？" width="20%">
    <template #footer>
      <span class="dialog-footer">
        <el-button size="small" @click="dialog_cluster_role_quit = false">取消</el-button>
        <el-button size="small" type="primary" @click="cluster_role_quit">确认</el-button>
      </span>
    </template>
  </el-dialog>

  <K8sClusterConfDialog @childClick="close_open_cluster_conf_dialog_value" :in_value="open_conf_dialog_value" />

  <K8sPodImageVersionCompareDialog @childClick="close_open_cluster_conf_dialog_value"
    v-model:visible="k8s_pod_image_version_compare_dialog_value" />

  <K8sNamespaceSyncDialog @childClick="close_open_cluster_conf_dialog_value"
    v-model:visible="k8s_namespace_sync_dialog_value" />
</template>

<script lang="ts">
import * as Request from "@/general/request";
import hostsGroupTable from "@/components/communal/hosts_group_table.vue";
import { ref, onMounted, computed } from "vue";
import { ElMessage } from "element-plus";
import SysCodeInput from "@/components/communal/sys_code_input.vue";
import K8sClusterConfDialog from "@/components/communal/k8s_cluster_conf_dialog.vue";
import K8sclusterEnvTable from "@/components/communal/k8scluster_env_table.vue";
import { server_config } from "@/service_config";
import K8sPodImageVersionCompareDialog from "@/components/communal/k8s_pod_image_version_compare_dialog.vue";
import KubernetesManageServiceManage from "@/components/k8s/kubernetes_manage_service_manage.vue";
import KubernetesManagePodManage from "@/components/k8s/kubernetes_manage_pod_manage.vue";
import KubernetesManageDeployments from "@/components/k8s/kubernetes_manage_deployments.vue";
import KubernetesManageStatefulSet from "@/components/k8s/kubernetes_manage_statefulset.vue";
import KubernetesManageJob from "@/components/k8s/kubernetes_manage_job.vue";
import KubernetesManageCRD from "@/components/k8s/kubernetes_manage_crd.vue";
import K8sNamespaceSyncDialog from "@/components/k8s/k8s_namespace_sync_dialog.vue";
import KubernetesManageStorage from "@/components/k8s/kubernetes_manage_storage.vue";

import {
  Refresh
} from '@element-plus/icons-vue'

export default {
  name: "kubernetes_manage",
  components: {
    hostsGroupTable,
    SysCodeInput,
    K8sClusterConfDialog,
    K8sclusterEnvTable,
    K8sPodImageVersionCompareDialog,
    KubernetesManageServiceManage,
    KubernetesManagePodManage,
    KubernetesManageDeployments,
    KubernetesManageStatefulSet,
    KubernetesManageJob,
    KubernetesManageCRD,
    K8sNamespaceSyncDialog,
    KubernetesManageStorage
  },
  setup() {
    let dialog_cluster_role_quit = ref(false)
    let env_id = ref("");
    let host_table_k8s: any = ref([]);
    let open_conf_dialog_value = ref(false);
    let configuration_dialog = ref(false);
    let k8s_cluster_list: any = ref(null);
    let configuration_form: any = ref({
      kubernetes_cluster_id: null,
      host_ids: [],
      powerboot: true,
      system_name: "rocky",
      system_version: "9",
      firewalld: false,
      selinux: false,
      role: "",
      kubernetes_role: ""
    });
    let websocketsend_cron: any = ref(null);
    let socket_reconnection_value = ref(0);
    let websock: any = ref(null);
    let info_info_type = ref("");
    let info_info_text = ref("");
    let kubernetes_cluster_ids = new Array<number>;
    let click_host_id = ref("");
    let kubernetes_cluster_id:any = ref(null);
    let cluster_data: any = ref(null);
    let cluster_select_visible = ref("");
    const dialog_cluster_select_visible = ref(false);
    let k8s_pod_image_version_compare_dialog_value = ref(false);
    let k8s_namespace_sync_dialog_value = ref(false);
    let get_node_cadvisor_info_monitoring_time = ref(30)


    //  调用服务组件传参
    const GetK8sClusterServiceRef = ref<InstanceType<typeof KubernetesManageServiceManage>>()
    const TabtClickServce = () => {
      /* 调用子组件的方法，不报错也可以不用问号，可以传参 */
      GetK8sClusterServiceRef.value?.get_k8s_cluster_service(kubernetes_cluster_id.value)
      /*  改变子组件的值
       GetK8sClusterServiceRef.value!.msg = '你好，我的世界！'   
       !为断言，防止为空报错 */
    }

    // 调用Pod组件传参
    const GetK8sClusterPodRef = ref<InstanceType<typeof KubernetesManagePodManage>>()
    const TabtClickPod = () => {
      GetK8sClusterPodRef.value?.get_k8s_cluster_pod(kubernetes_cluster_id.value)
    }

    // 调用Deployments组件传参
    const KubernetesManageDeploymentsRef = ref<InstanceType<typeof KubernetesManageDeployments>>()
    const TabtClickDeployments = () => {
      KubernetesManageDeploymentsRef.value?.get_k8s_cluster_deployments(kubernetes_cluster_id.value)
    }



    const host_pitch_on = (e: any) => {
      if (e) {
        click_host_id.value = e.host_id;
      }
    };

    const k8sclusterClick = (e: number) => {
      end_llection()
      kubernetes_cluster_ids = [e];
      start_collection()
      kubernetes_cluster_id.value = e;
      configuration_form.value.kubernetes_cluster_id = e;
      get_k8s_env_cluster_host();
    };

    const flush_info = () => {
      get_k8s_env_cluster_host();
      end_llection()
      start_collection()
    }

    const envClick = (e: any) => {
      env_id.value = e;
      get_env_host();
      get_env_k8s_cluster();
      clearInterval(websocketsend_cron.value);
      setTimeout(() => {
        start_collection();
      }, 200);
    };

    const k8s_role_check_CodoClick = (e: any) => {
      configuration_form.value.kubernetes_role = e;
    };

    const k8s_cluster_check_dialog = () => {
      dialog_cluster_select_visible.value = true;
      // get_env_k8s_cluster()
    };

    const selection_host_table = (e: any) => {
      configuration_form.value.host_ids = [];
      let i = 0,
        len = e.length;
      for (; i < len;) {
        configuration_form.value.host_ids.push(e[i].host_id as never);
        i++;
      }
    };

    const close_open_cluster_conf_dialog_value = () => {
      open_conf_dialog_value.value = false;
    };

    const tab_table_click = (e: any) => {
      if (!kubernetes_cluster_id.value) {
        ElMessage.warning("请先选择一个集群！");
        return 0;
      }

      if (e.props.name === "server") {
        TabtClickServce()
      }
      else if (e.props.name === "pod") {
        TabtClickPod();
      }
      else if (e.props.name === "deployments") {
        TabtClickDeployments();
      }
    };

    const start_collection = async () => {
      socket_reconnection_value.value = 0;
      await initWebSocket();
      ElMessage.success("正在获取最新信息..");
    };
    // onMounted(start_collection)

    // const stop_collection = () => {
    //   end_llection();
    // };

    const end_llection = () => {
      websock.value.close();
      info_info_type.value = "warning";
      info_info_text.value = "收集停止";
      websocketclose();
      ElMessage.warning("已停止获取最新信息！");
    };

    const initWebSocket = () => {
      const wsuri = server_config["background_ws"] + "/k8s_host_deploy_info";
      websock.value = new WebSocket(wsuri);
      websock.value.onmessage = websocketonmessage;
      websock.value.onopen = websocketonopen;
      websock.value.onerror = websocketonerror;
      websock.value.onclose = websocketclose;
    };

    const websocketonopen = () => {
      // 连接建立之后执行send方法发送数据，setInterval周期发送请求，ms
      websocketsend_cron.value = setInterval(() => {
        websocketsend(JSON.stringify(kubernetes_cluster_ids));
      }, get_node_cadvisor_info_monitoring_time.value * 1000);
      // websocketsend(JSON.stringify(table_soft_ids.value))
    };

    const websocketonerror = () => {
      // 连接建立失败重连
      if (socket_reconnection_value.value > 3) {
        return;
      }
      initWebSocket();
      socket_reconnection_value.value = socket_reconnection_value.value + 1;
    };

    const websocketonmessage = (e: any) => {
      // 数据接收
      const datas = JSON.parse(e.data);
      if (datas.success) {
        // this.$message.success(data.msg)
        info_info_type.value = "success";
        info_info_text.value = "正在收集";
        // datassetOption(data.data)
        let i = 0
        let len = host_table_k8s.value.length;
        let alen = datas.data.length;
        for (; i < len;) {
          let a = 0
          for (; a < alen;) {
            if (host_table_k8s.value[i]["kubernetes_manage_id"] === datas.data[a]["kubernetes_manage_id"]) {
              host_table_k8s.value[i]["deploy_event_info"] =
                "[" +
                datas.data[a]["deploy_event_finish_time"] +
                "]" +
                datas.data[a]["deploy_event_info"];
              host_table_k8s.value[i]["deploy_event_status"] =
                datas.data[a]["deploy_event_status"];
              host_table_k8s.value[i]["memory_use_text"] =
                datas.data[a]["memory_use_text"];
              host_table_k8s.value[i]["cpu_use_text"] =
                datas.data[a]["cpu_use_text"];
              host_table_k8s.value[i]["pod_number"] = datas.data[a]["pod_number"] + "/" +
                host_table_k8s.value[i]["pods"];
              host_table_k8s.value[i]["container_fs_io_current"] =
                datas.data[a]["container_fs_io_current"];
            }
            a++;
          }
          i++;
        }
      } else {
        ElMessage.error(datas.msg)
        info_info_type.value = "error";
        info_info_text.value = "收集失败";
        end_llection();
      }
    };

    const websocketsend = (Data: any) => {
      // 数据发送
      if (Data) {
        websock.value.send(Data);
      } else {
        websock.value.close();
      }
    };

    const websocketclose = () => {
      {
        // 关闭
        // console.log('断开连接', e)
        clearInterval(websocketsend_cron.value);
      }
    };

    const save_k8s_cluster_host = async () => {
      const response = await Request.POST(
        "/background/home/kubernetes/cluster_hosts_manage",
        {
          kubernetes_cluster_id: cluster_select_visible.value,
          host_ids: configuration_form.value.host_ids,
        }
      );
      if (response && response.data) {
        let return_data = response.data;
        if (return_data.success) {
          ElMessage.success(return_data.msg);
          dialog_cluster_select_visible.value = false;
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const get_k8s_env_cluster_host = async () => {
      const response = await Request.GET(
        "/background/home/kubernetes/env_cluster_host",
        { kubernetes_cluster_id: kubernetes_cluster_id.value }
      );
      if (response && response.data) {
        let return_data = response.data;
        if (return_data.success) {
          host_table_k8s.value = return_data.data;
          ElMessage.success(return_data.msg);
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const get_k8s_cluster_list = async () => {
      const response = await Request.GET("/background/home/deploy/k8s_conf_list", {});
      if (response && response.data) {
        let return_data = response.data;
        if (return_data.success) {
          k8s_cluster_list.value = return_data.data;
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const get_env_k8s_cluster = async () => {
      const response = await Request.GET(
        "/background/home/kubernetes/env_k8s_cluster",
        { env_id: env_id.value }
      );
      if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
          cluster_data.value = return_data.data;
          ElMessage.success(return_data.msg);
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const get_k8s_api_sign = async () => {
      if (!click_host_id.value) {
        ElMessage.warning("请单机一行，进行主机选择");
        return;
      }

      const response = await Request.POST(
        "/background/home/kubernetes/k8s_api_sign_manage",
        {
          host_id: click_host_id.value,
          kubernetes_cluster_id: kubernetes_cluster_id.value,
        }
      );
      if (response && response.data) {
        let return_data = response.data;
        if (return_data.success) {
          k8s_cluster_list.value = return_data.data;
          ElMessage.success(return_data.msg);
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const get_env_host = async () => {
      const response = await Request.GET(
        "/background/home/deploy/query_env_hosts_k8s",
        { env_id: env_id.value }
      );
      if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
          host_table_k8s.value = return_data.data;

          kubernetes_cluster_ids = [];
          let i = 0,
            len = host_table_k8s.value.length;
          for (; i < len;) {
            if (
              kubernetes_cluster_ids.indexOf(
                host_table_k8s.value[i]["kubernetes_cluster_id"]
              ) === -1 &&
              host_table_k8s.value[i]["kubernetes_cluster_id"]
            ) {
              kubernetes_cluster_ids.push(
                host_table_k8s.value[i]["kubernetes_cluster_id"]
              );
            }
            i++;
          }

          ElMessage.success(return_data.msg);
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const k8s_role_initialize = async () => {
      const response = await Request.POST(
        "/background/home/deploy/k8s_role_deploy",
        configuration_form.value
      );
      if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
          // host_table_k8s.value = return_data.data
          ElMessage.success(return_data.msg);
          configuration_dialog.value = false
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };

    const cluster_role_quit = async () => {
      const response = await Request.DELETE(
        "/background/home/deploy/k8s_role_deploy",
        configuration_form.value
      );
      if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
          // host_table_k8s.value = return_data.data
          ElMessage.success(return_data.msg);
          dialog_cluster_role_quit.value = false
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    };


    // 校对角色信息
    const verify_node_info = async () => {
      const response = await Request.PUT(
        "/background/home/kubernetes/verify_node_info",
        {
          host_ids: configuration_form.value.host_ids,
          kubernetes_cluster_id: kubernetes_cluster_id.value
        }
      );
      if (response && response.data) {
        var return_data = response.data;
        if (return_data.success) {
          ElMessage.success(return_data.msg);
          flush_info()
        } else {
          ElMessage.error(return_data.msg);
        }
      }
    }

    onMounted(get_k8s_cluster_list);

    return {
      verify_node_info,
      flush_info,
      get_k8s_env_cluster_host,
      cluster_role_quit,
      envClick,
      dialog_cluster_role_quit,
      configuration_dialog,
      activeName_1: "host",
      activeName_2: "configuration_general",
      k8s_role_check_CodoClick,
      selection_host_table,
      configuration_form,
      host_table_k8s,
      k8s_role_initialize,
      k8s_cluster_list,
      tab_table_click,
      close_open_cluster_conf_dialog_value,
      open_conf_dialog_value,
      // stop_collection,
      get_k8s_api_sign,
      host_pitch_on,
      mainH: document.documentElement.clientHeight / 2 - 100,
      tableH: document.documentElement.clientHeight - 320,
      k8sclusterClick,
      env_id,
      dialog_cluster_select_visible,
      cluster_data,
      k8s_cluster_check_dialog,
      cluster_select_visible,
      save_k8s_cluster_host,
      k8s_pod_image_version_compare_dialog_value,
      k8s_namespace_sync_dialog_value,
      GetK8sClusterServiceRef,
      GetK8sClusterPodRef,
      KubernetesManageDeploymentsRef,
      get_node_cadvisor_info_monitoring_time
    };
  },
};
</script>

<style scoped>
.el-button_more_mini {
  height: 25px;
  padding: 4px 8px;
  font-size: 8px;
}</style>
